<?php

namespace IDock\Insurance\ZSIC\Response;

use IDock\Http\Response;
use IDock\IDock\IDockEnums;
use IDock\Insurance\ZSIC\Response\AllZSICResponse;
use IDock\Insurance\ZSIC\ZSICEnums;
use IDock\Printer\EPolicyDownloadPrinter;
use IDock\Printer\Premium\PremiumBIPrinter;
use IDock\Printer\Premium\PremiumCIPrinter;
use IDock\Printer\Premium\PremiumCoveragePrinter;
use IDock\Printer\Premium\PremiumFactorPrinter;
use IDock\Printer\Premium\PremiumInquiryPrinter;
use IDock\Printer\Premium\PremiumTaxPrinter;
use IDock\Printer\PremiumUnderwritingPrinter;
use IDock\Printer\UploadFilePrinter;
use IDock\Printer\VehicleModelPrinter;
use IDock\Printer\VehiclePrinter;

class ElecPolicyDownloadResponse extends AllZSICResponse
{
    public $printer = EPolicyDownloadPrinter::class;

    public function printerInit(): Response
    {
        $elecPrinter = new EPolicyDownloadPrinter();

        $data = $this->getBody();
        $elecPrinter->data = $data['body']['application']['elePlyStr'] ?? '';
//        if (!empty($elecPrinter->data)) {
//            $elecPrinter->data = base64_decode($elecPrinter->data);
//        }
        $elecPrinter->finish = true;
        if (empty($elecPrinter->data)) {
            $elecPrinter->finish = false;
        }
        $this->printer = $elecPrinter;

        return $this;
    }

}
